<?php

class Application_Model_User extends Application_Model_Object implements Zend_Acl_Role_Interface
{
    const ROLE_GUEST   = 'guest';
    const ROLE_WRITER  = 'writer';
    const ROLE_ADMIN   = 'admin';

    protected $_username;
    protected $_password;
    protected $_roleid;

    public function setOptions(array $options)
    {
        if (isset($options['roleid'])) {
            $this->setRoleid($options['roleid']);
            unset($options['roleid']);
        }

        if (isset($options['username'])) {
            $this->setUsername($options['username']);
            unset($options['username']);
        }

        if (isset($options['password'])) {
            $this->setPassword($options['password']);
            unset($options['password']);
        }

    }

    public function setUsername($username)
    {
        $this->_username = $username;
    }
    public function getUsername()
    {
        return $this->_username;
    }

    public function setPassword($password)
    {
        $this->_password = $password;
    }
    public function getPassword()
    {
        return $this->_password;
    }

    public function setRoleid($roleid)
    {
        $this->_roleid = $roleid;
    }
    public function getRoleid()
    {
        if (null === $this->_roleid) {
            return self::ROLE_GUEST;
        } else {
            return $this->_roleid;
        }
    }


}

